package query

import "go.mongodb.org/mongo-driver/bson"

func Eq(filed string, value any) *Query {
	query := Query{}
	query.Filter = map[string]bson.M{filed: bson.M{"$eq": value}}
	return &query
}
func Ne(filed string, value any) *Query {
	query := Query{}
	query.Filter = map[string]bson.M{filed: bson.M{"$ne": value}}
	return &query
}
func Gt(filed string, value any) *Query {
	query := Query{}
	query.Filter = map[string]bson.M{filed: bson.M{"$gt": value}}
	return &query
}
func Lt(filed string, value any) *Query {
	query := Query{}
	query.Filter = map[string]bson.M{filed: bson.M{"$lt": value}}
	return &query
}
func Ge(filed string, value any) *Query {
	query := Query{}
	query.Filter = map[string]bson.M{filed: bson.M{"$gte": value}}
	return &query
}
func Le(filed string, value any) *Query {
	query := Query{}
	query.Filter = map[string]bson.M{filed: bson.M{"$lte": value}}
	return &query
}

func ASC(filed string) *Query {
	q := &Query{}
	sortAssignment(q, filed, 1)
	return q
}
func DESC(filed string) *Query {
	q := &Query{}
	sortAssignment(q, filed, -1)
	return q
}
func In(filed string, items ...any) *Query {
	q := &Query{}
	q.Filter = map[string]bson.M{filed: bson.M{"$in": items}}
	return q
}
